﻿<Window x:Class="XiphTestGui.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Lecture des tags des fichiers FLAC" MinHeight="600" MinWidth="500" SizeToContent="WidthAndHeight">
  <Grid Margin="10">
    <Grid.Resources>
      <Style x:Key="txtTagName" TargetType="TextBlock">
        <Setter Property="HorizontalAlignment" Value="Right" />
        <Setter Property="FontWeight" Value="Bold" />
      </Style>
      <Style x:Key="txtTagValue" TargetType="TextBlock">
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="Grid.Column" Value="1" />
      </Style>
    </Grid.Resources>
    
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <Button x:Name="btnOpen" Height="23" Width="75" Content="Ouvrir..." />
      <TextBlock x:Name="txtPath" Grid.Column="1" VerticalAlignment="Center" Margin="5,0" TextTrimming="CharacterEllipsis" />
    </Grid>

    <GroupBox Header="Tags principaux" Grid.Row="2">
      <Grid>        
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <TextBlock Style="{StaticResource txtTagName}" Text="Artiste : " />
        <TextBlock Style="{StaticResource txtTagName}" Text="Titre : " Grid.Row="1" />
        <TextBlock Style="{StaticResource txtTagName}" Text="Album : " Grid.Row="2" />
        <TextBlock Style="{StaticResource txtTagName}" Text="N° de piste : " Grid.Row="3" />
        <TextBlock Style="{StaticResource txtTagName}" Text="Genre : " Grid.Row="4" />
        <TextBlock Style="{StaticResource txtTagName}" Text="Date : " Grid.Row="5" />
        <TextBlock Style="{StaticResource txtTagName}" Text="Pochette : " Grid.Row="6" />

        <TextBlock Style="{StaticResource txtTagValue}" Text="{Binding Artist}" />
        <TextBlock Style="{StaticResource txtTagValue}" Text="{Binding Title}" Grid.Row="1" />
        <TextBlock Style="{StaticResource txtTagValue}" Text="{Binding Album}" Grid.Row="2" />
        <TextBlock Style="{StaticResource txtTagValue}" Text="{Binding TrackNumber}" Grid.Row="3" />
        <TextBlock Style="{StaticResource txtTagValue}" Text="{Binding Genre}" Grid.Row="4" />
        <TextBlock Style="{StaticResource txtTagValue}" Text="{Binding Date}" Grid.Row="5" />
        <Image Grid.Row="6" Grid.Column="1" HorizontalAlignment="Left" Source="{Binding Arts[0].Picture}" MaxWidth="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Source.PixelWidth}" MaxHeight="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Source.PixelHeight}" Stretch="Uniform" />
      </Grid>
    </GroupBox>

    <GroupBox Header="Informations techniques" Grid.Row="1">
      <Grid>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <TextBlock Style="{StaticResource txtTagName}" Text="Nombre de canaux : " />
        <TextBlock Style="{StaticResource txtTagName}" Text="Taux d'échantillonnage : " Grid.Row="1" />
        <TextBlock Style="{StaticResource txtTagName}" Text="Version de codec : " Grid.Row="2" />
        <TextBlock Style="{StaticResource txtTagName}" Text="Durée : " Grid.Row="3" />
        <TextBlock Style="{StaticResource txtTagName}" Text="Débit moyen : " Grid.Row="4" />
        <TextBlock Style="{StaticResource txtTagName}" Text="Taux de compression : " Grid.Row="5" />
        <TextBlock Style="{StaticResource txtTagName}" Text="Taille de l'échantillon : " Grid.Row="6" />

        <TextBlock Style="{StaticResource txtTagValue}" Text="{Binding Channels}" />
        <TextBlock Style="{StaticResource txtTagValue}" Text="{Binding SampleRate, StringFormat={}{0:N0} Hertz}" Grid.Row="1" />
        <TextBlock Style="{StaticResource txtTagValue}" Text="{Binding CodecVersion, StringFormat={}FLAC {0}}" Grid.Row="2" />
        <TextBlock Style="{StaticResource txtTagValue}" Text="{Binding Duration, StringFormat={}{0:N0} secondes}" Grid.Row="3" />
        <TextBlock Style="{StaticResource txtTagValue}" Text="{Binding AverageBitrate, StringFormat={}{0:N0} bits par seconde}" Grid.Row="4" />
        <TextBlock Style="{StaticResource txtTagValue}" Text="{Binding Ratio, StringFormat={}{0:P}}" Grid.Row="5" />
        <TextBlock Style="{StaticResource txtTagValue}" Text="{Binding BitsPerSample, StringFormat={}{0} bits}" Grid.Row="6" />
      </Grid>
    </GroupBox>
  </Grid>
</Window>